import java.util.Scanner;

public class Solution {
    public int lengthOfLongestSubstring(String s){
        char[] ss = s.toCharArray();//将字符串转化为字符数组
        int left = 0,right = 0,n = s.length();
        int[] hash = new int[128];//用数组模拟模拟哈希表
        int ret = 0;
        while(right < n){
          hash[ss[right]]++;//进入窗口
          while (hash[ss[right]] > 1){//判断
              hash[ss[left++]]--;//出窗口
          }
          ret = Math.max(ret,right-left+1);//更新结果
          right++;
        }
        return ret;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while(in.hasNextLine()){
            String str = in.nextLine();
            Solution solution = new Solution();
            System.out.println(solution.lengthOfLongestSubstring(str));
        }
    }
}
